<%@ page import="com.useeinfo.oa.modules.security.util.SessionKeyUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style>
    .form-horizontal .row{
        margin: 0 55px 0 55px;
    }
</style>
<div class="main-content">
    <div class="box box-main">
        <form id="inputForm" model="post" action="<c:url value="/web/admin/enterprise/toChangeEnterprise.action"/>" method="post" class="form-horizontal">
            <div class="box-body">
                <div class="row">
                    <div class="form-group has-feedback clearfix">
                        <strong>选择企业：</strong>
                    </div>
                    <div class="form-group has-feedback">
                        <input path="enterprise" id="enterprise" name="enterprise" class="form-control" placeholder="选择企业">
                    </div>
                </div>
            </div>

            <div class="box-footer">
                <div class="row">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 切 换 </button>&nbsp;

                        <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="closeView()"><i class="fa fa-times"></i> 关 闭</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $("#inputForm").validate({
        submitHandler: function(form){
            js.ajaxSubmitForm($(form), function(data){
                js.showMessage(data.msg);
                if(data.status == Global.NO){
                    var myHref=window.location.href;
                    window.location.href=myHref.split("#")[0];
                }
            }, "json");
        }
    });

    $('#enterprise').magicSuggest({
        allowFreeEntries: false,
        data: '<c:url value="/web/admin/enterprise/getEnterpriseListMagicChangeUser.action" />',
        queryParam: 'q',
        valueField: "value",
        displayField: "text",
        maxSelection: 1,
        noSuggestionText: '',
        placeholder: '选择企业',
        required: true,
        autoSelect: true,
        selectFirst: true,
        value: magicSuggestValue('<%=SessionKeyUtils.getSessionEnterprise(request).getId() %>')
    });

    function closeView() {
        layer.close(LayWin['changeEnterprise']);
    }



</script>


